Learn how to use Algolia’s Distinct feature to deduplicate results that share a common attribute.
number_of_sales
. Besides, you can use Algolia’s distinct feature to deduplicate designs. This way, when someone searches for “t-shirt”, they only get one of each design.
thumbnail_url
, which may be irrelevant and add noise, nor into color_variants
, because it could lead to false positives. Therefore, you can set design
, type
, and color
as searchableAttributes
.
distinct
, you first need to set design
as attributeForDistinct
during indexing time. Only then can you set distinct
to true
to deduplicate your results.
Note that setting distinct
at indexing time is optional. If you want to, you can set it at query time instead.
attributeForDistinct
is set, you can enable distinct
by setting it to true
.
distinct
to true
or 1
interchangeably.design
, type
, and color
attributes in the drop-down menu one after another.true
.design
.true
, you get one color for each design. To control which one, you can set a new attribute with business metrics, for example, number_of_sales
, and set it up for custom ranking.
Additionally, you can display all available colors for each item thanks to the color_variants
attribute.
This way, users can access all possible variants from the search results without the page being crowded with too many items.